<?php
function itemIndexArray($category) {


$hostname="localhost";
$username="root";
$password="";
$database="db_dinkonst";
$i=0;
//Connnects to database
mysql_connect($hostname,$username,$password);
mysql_select_db($database) or die( "Unable to select database");
         $result = mysql_query("select items.item_id from items, item_subCategory, subCategory, category where items.item_id = item_subCategory.item
and item_subCategory.subCategory = subCategory.subCategory_id
and subCategory.parentCategoryID = category.category_id
and category.categoryName = '$category'
order by item_id DESC");

                 while($row = mysql_fetch_assoc($result))  {
                        $itemId = $row["item_id"];
                        $itemIdArray[$i] = $itemId;
                        ++$i;
                        }

return ($itemIdArray);
}
?>
